# $Id: CMakeLists.txt 470 2008-05-27 16:27:22Z agjermun $
# CMakelists for the project, includes build and installation of ml278 and installs data-files (Media/ etc)
#
# ml278
# Copyright (C) 2008 Bjørn Øivind Bjørnsen, Aleksander Gjermundsen, Knut Andre Tidemann, Thomas Hansen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

project (ml278)

# this must be possible to do a better way (check if set, if not set, initialise to a default value)
set (CMAKE_BUILD_TYPE "Debug")
set (CMAKE_INSTALL_PREFIX "/opt/ml278" CACHE INTERNAL "Prefix where ${PROJECT_NAME} will be installed")

# Set the install path prefix
IF(WIN32 AND NOT UNIX)
	set (CMAKE_INSTALL_PREFIX "c:/ml278" CACHE INTERNAL "Prefix where ${PROJECT_NAME} will be installed")
ELSE(WIN32 AND NOT UNIX)
	set (CMAKE_INSTALL_PREFIX "/opt/ml278" CACHE INTERNAL "Prefix where ${PROJECT_NAME} will be installed")
ENDIF(WIN32 AND NOT UNIX)

add_subdirectory (src)
add_subdirectory (Media)

# Embed OGRE into the install on Windows, copy the correct plugins.cfg for the platform and copy launcher
IF(WIN32 AND NOT UNIX)
	INSTALL(DIRECTORY c:/OgreSDK/bin/release/ DESTINATION .)
	INSTALL(FILES plugins.cfg.win32 DESTINATION .)
	INSTALL(FILES tools/startml278.bat DESTINATION bin)
ELSE(WIN32 AND NOT UNIX)
	INSTALL(FILES plugins.cfg DESTINATION .)
ENDIF(WIN32 AND NOT UNIX)
# Copy to the destination directory
INSTALL(FILES resources.cfg OgreCore.zip DESTINATION .)
# Copy the licence and documentation
INSTALL(FILES COPYING README DESTINATION .)

INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Student project")
SET(CPACK_PACKAGE_VENDOR "The Moonwalkers")
SET(CPACK_PACKAGE_NAME "ml278")
SET(CPACK_PACKAGE_VERSION "SVN")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "ml278")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
IF(WIN32 AND NOT UNIX)
  SET(CPACK_GENERATOR "NSIS")
  SET(CPACK_PACKAGE_FILE_NAME "ml278-SVN-Win32")
  SET(CPACK_SOURCE_STRIP_FILES "_CPack_Packages")
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Media\\\\gui\\\\ml.ico")
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "ml278.exe")
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ml278")
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\ml278.holdertil.net")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\ml278.holdertil.net")
  SET(CPACK_NSIS_CONTACT "")
  SET(CPACK_NSIS_MODIFY_PATH OFF)
ELSE(WIN32 AND NOT UNIX)
  SET(CPACK_GENERATOR "TGZ")
  SET(CPACK_PACKAGE_FILE_NAME "ml278-SVN-Linux")
  SET(CPACK_STRIP_FILES "bin/ml278")
  SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "ml278" "ml278")
INCLUDE(CPack)


